'use strict';

/** @type Egg.EggPlugin */
module.exports = {
  sequelize: {
    enable: true,
    package: 'egg-sequelize',
    // eslint-disable-next-line eggache/no-unexpected-plugin-keys
    timezone: '+08:00', // 保存为本地时区
    // eslint-disable-next-line eggache/no-unexpected-plugin-keys
    dialectOptions: {
      dateStrings: true,
      typeCast(field, next) {
        // for reading from database
        if (field.type === 'DATETIME') {
          return field.string();
        }
        return next();
      },
    },
  },

  valparams: {
    enable: true,
    package: 'egg-valparams',
  },
  // jwt 加密鉴权
  jwt: {
    enable: true,
    package: 'egg-jwt',
  },
  // 跨域
  cors: {
    enable: true,
    package: 'egg-cors',
  },
}
;
